<div style="position: absolute;top: 120px; left: 450px" class="navBox">
    <div class="comWidth">
        <ul class="nav">
   <li  class="active"><a href="javascript:void(0)"> 付款登记：</a><span></span></li>
   <li> <a href="javascript:void(0)" onclick="getPoMain1('getPoMain1')" style="font-size: 15px ;font-weight: bold">货到付款</a></li>
   <li> <a href="javascript:void(0)"onclick="getPoMain1('getPoMain2')" style="font-size: 15px ;font-weight: bold">款到发货</a></li>
   <li> <a href="javascript:void(0)"onclick="getPoMain1('getPoMain3')" style="font-size: 15px ; font-weight: bold">预付款付款</a></li>
        </ul>
    </div>
</div>

<br>
<table class="altrowstable">
    <tr>
        <td>编号</td>
        <td>采购单编号</td>
        <td>创建时间</td>
        <td>供应商名称</td>
        <td>创建用户</td>
        <td>附加费用</td>
        <td>采购产品总价</td>
        <td>采购单总价格</td>
        <td>付款方式</td>
        <td>处理状态</td>
        <td>明细</td>
        <td>操作</td>
    </tr>
    <tbody id="getReceiptPoMainBody">

    </tbody>
    <div  style="position: absolute; margin-top: 0px;padding-left: 700px">
        <ul id="page">分页</ul>
    </div>
</table>


<script type="text/html" id="getReceiptPoMainTemplate">
    {{each data}}
    <tr>
        <td>{{$index+1}}</td>
        <td>{{$value.poID}}</td>
        <td>{{$value.createTime}}</td>
        <td>{{$value.venderCode}}</td>
        <td>{{$value.account}}</td>
        <td>{{$value.tipFee}}</td>
        <td>{{$value.productTotal}}</td>
        <td>{{$value.poTotal}}</td>
        <td>{{$value.payType}}</td>
        <td>{{$value.status}}</td>
        <td><font style="color: #e8198b" onclick="{{'getPoItem(\''+ $value.poID +'\')'}}">查看明细</font></td>
        <td><span style="color: #b51204" onclick="{{'payPoMain(\''+$value.poID+'\')'}}">付款</span></td>
    </tr>
    {{/each}}
</script>
<script>





    $(function () {
        getPoMain1('getPoMain1');
    })
    function getPoMain1(url) {
        showPage({
            currentPage:1,
            pageSize:3,
            url:url,
            templateId: 'getReceiptPoMainTemplate',
            contentId: 'getReceiptPoMainBody'
        })
    }
    
    function payPoMain(poID) {
        var flag= window.confirm("确认付款？");
        if (flag){
            Ajax.post('payPoMain',{
                poID:poID
            },function (result) {
                alert(result.message);
                if (result.data=="货到付款"){
                    getPoMain1('getPoMain1');
                } else if (result.data=="款到发货"){
                    getPoMain1('getPoMain2');
                } else {
                    getPoMain1('getPoMain3');
                }
            })
        }

    }

        $(document).ready(function (){// ready 事件
            $("li").each(function(index){//便利对象
                $(this).click(function(){//点击触发事件
                    $("li").removeClass("active");//删除当前元素的样式
                    $("li").eq(index).addClass("active");//添加当前元素的样式
                });
            });
        });

</script>